package com.lovedice;

import com.lovedice.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Feedback extends Activity {
	Button send, back;
	EditText subject, emailtext;
	String emailAddress;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.feedback);
		send = (Button) findViewById(R.id.emailsendbutton);
		back = (Button) findViewById(R.id.emailbackbutton);
		emailAddress = "lovedices@gmail.com";
		subject = (EditText) findViewById(R.id.text_email_subject);
		emailtext = (EditText) findViewById(R.id.text_email_content);
		send.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
				emailIntent.setType("plain/text");
				emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { emailAddress } );
				emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText().toString() );
				emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText().toString() );
				Feedback.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
			}
		});
		
		back.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Feedback.this.finish();
			}
		});
	}
}